<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title>Edit User</title>
        <link rel="stylesheet" href="Resources/jquery-ui-1.11.2.custom/jquery-ui.css">
        <link rel="stylesheet" href="Resources/bootstrap/css/bootstrap.css">
        <link rel="stylesheet" href="Resources/bootstrap/css/bootstrap.css.map">
        <link rel="stylesheet" href="Resources/bootstrap/css/bootstrap-theme.css">
        <link rel="stylesheet" href="Resources/bootstrap/css/bootstrap-theme.css.map">
        <link rel="stylesheet" href="Resources/style/general.css">
        <script src="Resources/js/jquery-1.11.1.js"></script>
        <script type="text/javascript" src="Resources/jquery-ui-1.11.2.custom/jquery-ui.js"></script>
        <script type="text/javascript" src="Resources/bootstrap/js/bootstrap.js"></script>
        <link rel="stylesheet" href="Resources/style/general.css">
        <script src="Resources/js/sha3.js"></script>
    </head>
    <body>
        <?php include_once '../PlantillasUI/_MainLayout.php'; ?>
        <?php include_once '../Model/usuarioDao.php';?>
        <div class="row">
             <div class="col-xs-3 col-sm-2"></div>
             <div class="col-xs-12 col-sm-8">
                 <div id="wrapper">
                    
                        <form class="form-horizontal" role="form" method="post" action="../Controller/editUserController.php">
                            
                            <div class="form-group">
                               <div class="col-sm-4"></div>
                               <div class="col-sm-4">
                                   <label><h1><font color="white"><strong>Edit Profile of User</strong></font></h1></label>
                               </div>
                               <div class="col-sm-4"></div>
                            </div>
                            <?php 
                                if(isset($_SESSION['usuario']))
                                    $user = $_SESSION['usuario'];
                                echo '<input type="hidden" class="form-control" id="user" name="user" value="'.$user.'">';

                                $results_users = usuario($user);
                            ?>
                            <!--<table><tr><td class="col-sm-4">-->
                            <div class="form-group">
                               <div class="col-sm-4"></div>
                               <div class="col-sm-4">
                                   <label><font color="white">First Name</font></label>
                                   <!--<input type="text" class="form-control" id="firstName" name="firstName" placeholder="First Name">-->
                                   <?php 
                                    echo '<input type="text" class="form-control" id="firstName" name="firstName" placeholder="First Name" value="'.$results_users[0]['firstName'].'">';
                                   ?>
                               </div>
                               <div class="col-sm-4"></div>
                            </div>
                            <div class="form-group">
                               <div class="col-sm-4"></div>
                               <div class="col-sm-4">
                                   <label><font color="white">Middle Name</font></label>
                                   <!--<input type="text" class="form-control" id="middleName" name="middleName" placeholder="Middle Name">-->
                                   <?php 
                                    echo '<input type="text" class="form-control" id="middleName" name="middleName" placeholder="Middle Name" value="'.$results_users[0]['middleName'].'">';
                                   ?>
                               </div>
                               <div class="col-sm-4"></div>
                            </div>
                            <div class="form-group">
                               <div class="col-sm-4"></div>
                               <div class="col-sm-4">
                                   <label><font color="white">Last Name</font></label>
                                   <!--<input type="text" class="form-control" id="lastName" name="lastName" placeholder="Last Name">-->
                                   <?php 
                                    echo '<input type="text" class="form-control" id="lastName" name="lastName" placeholder="Last Name" value="'.$results_users[0]['LastName'].'">';
                                   ?>
                               </div>
                               <div class="col-sm-4"></div>
                            </div>
                            <div class="form-group">
                               <div class="col-sm-4"></div>
                               <div class="col-sm-4">
                                   <label><font color="white">Rol</font></label>
                                   <select type="text" class="form-control" id="rol" name="rol">
                                       <?php 
                                            $results = roles();
                                            $cant = count($results);
                                            for ($i = 0; $i < $cant; $i++) {
                                                if($results[$i]['roleCode']==$results_users[0]['roleCode']){
                                                    echo '<option value="' . $results[$i]['roleCode'] . '" selected>'.$results[$i]['rolName'].'</option>';
                                                }else{
                                                    echo '<option value="' . $results[$i]['roleCode'] . '">'.$results[$i]['rolName'].'</option>';
                                                }
                                            }
                                       ?>
                                   </select>
                               </div>
                               <div class="col-sm-4"></div>
                            </div>
                            <!--</td><td class="col-sm-4">-->
                            <div class="form-group">
                               <div class="col-sm-4"></div>
                               <div class="col-sm-4">
                                   <label><font color="white">Department</font></label>
                                   <select type="text" class="form-control" id="department" name="department">
                                       <?php 
                                            $results = departamentos();
                                            $cant = count($results);
                                            for ($i = 0; $i < $cant; $i++) {
                                                if($results[$i]['idDepartment']==$results_users[0]['idDepartment']){
                                                    echo '<option value="' . $results[$i]['idDepartment'] . '" selected>'.$results[$i]['DepartmentName'].'</option>';
                                                }else{
                                                    echo '<option value="' . $results[$i]['idDepartment'] . '">'.$results[$i]['DepartmentName'].'</option>';
                                                }
                                            }
                                       ?>
                                   </select>
                               </div>
                               <div class="col-sm-4"></div>
                            </div>
                            <div class="form-group">
                               <div class="col-sm-4"></div>
                               <div class="col-sm-4">
                                   <label><font color="white">Company</font></label>
                                   <select type="text" class="form-control" id="company" name="company">
                                       <?php 
                                            $results = companias();
                                            $cant = count($results);
                                            for ($i = 0; $i < $cant; $i++) {
                                                if($results[$i]['idCompany']==$results_users[0]['idCompany']){
                                                    echo '<option value="' . $results[$i]['idCompany'] . '" selected>'.$results[$i]['companyName'].'</option>';
                                                }else{
                                                    echo '<option value="' . $results[$i]['idCompany'] . '">'.$results[$i]['companyName'].'</option>';
                                                }
                                            }
                                       ?>
                                   </select>
                               </div>
                               <div class="col-sm-4"></div>
                            </div>
                            <div class="form-group">
                               <div class="col-sm-4"></div>
                               <div class="col-sm-4">
                                   <label><font color="white">Mail</font></label>
                                   <!--<input type="text" class="form-control" id="mail" name="mail" placeholder="Mail">-->
                                   <?php 
                                    echo '<input type="text" class="form-control" id="mail" name="mail" placeholder="Mail" value="'.$results_users[0]['userMail'].'">';
                                   ?>
                               </div>
                               <div class="col-sm-4"></div>
                            </div>
                            <!--</td></tr></table>-->
                            <br/>
                            <div class="col-sm-4"></div>
                            <div class="col-sm-4">
                                <input id="submit" type="image" value="submit" src="../Resources/img/btn_enter.png" alt="Save" class="enterButton">
                            </div>
                            <div class="col-sm-4"></div>
                            <?php 
                                /*if(isset($_SESSION['usuario']))
                                    $user = $_SESSION['usuario'];
                                echo '<input type="hidden" class="form-control" id="user" name="user" value="'.$user.'">';*/
                            ?>
                        
                        </form>
                    
                <br/><br/><br/>
                 </div>
             </div>
             <div class="col-xs-3 col-sm-2"></div>
        </div>
        <?php include_once '../PlantillasUI/_footerLayout.php'; ?>
        <?php
        // put your code here
        ?>
    </body>
</html>